<template>
  <div>
    <!-- ref用来辅助开发者在不依赖于原生DOM方法的情况下,获取DOM元素或组件的引用,通俗的来说ref就是帮助我们查找元素的(也能查找组件) -->

    <!-- 每个vue组件实例上都包含一个$ref对象,里面储存着对应的DOM元素或组件的引用 -->
    <button @click="getRight">获取子组件</button>
    <MyRight ref="myright"></MyRight>
    <my-left></my-left>
  </div>
</template>

<script>
import MyRight from "@/components/MyRight.vue";
import MyLeft from "@/components/MyLeft.vue";

export default {
  methods: {
    getRight() {
      this.$refs.myright.find();
    },
  },
  components: { MyRight, MyLeft },
};
</script>

<style lang="scss" scoped>
</style>